//
//@File    :	15.19_constcast.cpp
//@Time    :	2022/03/25 09:52:00
//@Auther  :	Sun Sheng
//@Contact :	970340843@qq.com
//@Desc    :	using const_cast<>
//

//四种类型转换
//dynamic_cast;const_cast;static_cast;reinterpret_cast;


#include <iostream>
using std::cout;
using std::endl;

void change(const int * pt,int n);

int main()
{
    int pop1=38383;
    const int pop2=2000;

    cout<<"pop1,pop2: "<<pop1<<", "<<pop2<<endl;
    change(&pop1,-103);
    change(&pop2,-103);
    cout<<"pop1,pop2: "<<pop1<<", "<<pop2<<endl;
    system("pause");
    return 0;
    //输出结果为
    //pop1,pop2:38383,2000
    //pop1,pop2:38280,2000

}

void change(const int *pt,int n){
    int *pc;

    pc=const_cast<int *>(pt);
    *pc+=n;
}